/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$(function(){
    
    $("#editEventModal").dialog({
        modal:true,
        autoOpen:false,
        width:550,
        resizable:false,
        dialogClass:"clearTopModal editEvent"
    });
    $("#paymentModal").dialog({
        modal:true,
        autoOpen:false,
        width:400,
        resizable:false,
        title:"Event Checkout",
        dialogClass:"payModal",
        stack:false
    });
    $(".bindEventBoxes").click(function(){
        swapEvent(this);
    })
   $(".userprofilemodal").dialog({
       modal:true,
       autoOpen:false,
       width:550,
       resizable:false,
       dialogClass:"clearTopModal userprofile"
   });
    $(".userprofilemodal").dialog({
        modal:true,
        autoOpen:false,
        width:550,
        resizable:false,
        dialogClass:"clearTopModal userprofile"
    });
    $("#uploadModal").dialog({
        modal:true,
        autoOpen:false,
        width:550,
        resizable:false,
        dialogClass:"clearTopModal uploadmodal"
    });
    $("#disclaimerModal").dialog({
        modal:true,
        autoOpen:false,
        resizable:false,
        width:300,
        dialogClass:"clearTopModal dsModal"
    });
    $("#disclaimerCheckbox").click(function(){
        var isCheck=$(this).is(":checked");
        if(isCheck){
            $("#payBox").removeClass("hide");
        }else{
            $("#payBox").addClass("hide");
        }
    });
    $("input[type='radio'][name='payType']").click(function(){
        var $curEle=$(this);
        if($curEle.prop("id")=="pOnsite"){
            //meaning the pay onsite has been click
            $("#paymentForm").addClass("hide");
            $("#onSiteForm").removeClass("hide");
        }else{
            $("#onSiteForm").addClass("hide");
            $("#paymentForm").removeClass("hide");
        }
    });
      $("#signupModal").dialog({
                   modal:true,
                   autoOpen:false,
                   width:450,
                   dialogClass:"v_signUp",
                   resizable:false,
                   buttons:{
                       "Sign up":function(){
		           var shouldSend=formIntegrity($("FORM[name='vevive_signup']"));
	                   if(shouldSend){
                           	userSignup(this);
			   }
                       },
                       "Clear":function(){
                              clearSignupModal(this);
                       },
                       "Close":function(){
                           $(this).dialog("close");
                       }

                   }
               });
               $("#registerBtn").click(function(){
                   $("#signupModal").dialog("open");
               });

               $("#signinBtn").click(function(){
                	$("FORM[name='signinForm']").submit();
		});
               $("#emailTag,#pwdTag").keypress(function(e){
                   if(e.which == 13){
                        $("#signinBtn").click();
                   }
                });

                $(".whereToBtn").click(function(){
                    var whichBtn=$(this).val();
                    if(whichBtn=="next"){
                        $("#firstpart").hide();
                        $("#secondpart").show();
                        $("li.singleNavs:eq(0)").removeClass("fillColor");
                        $("li.singleNavs:eq(1)").addClass("fillColor");
                    }else{
                        $("#secondpart").hide();
                        $("#firstpart").show();
                        $("li.singleNavs:eq(1)").removeClass("fillColor");
                        $("li.singleNavs:eq(0)").addClass("fillColor");
                    }
                });
                $("#isStudent").click(function(){
                        var isCheck=$(this).attr("checked")?true:false;
                       if(isCheck){
                           $(".studentBox").show();
                       }else{
                           $(".studentBox").hide();
                       }
                });
                 $("#isStudent").attr("checked")?$(".studentBox").show():$(".studentBox").hide();
});

